<template>
	<view class="container">
		<view class="content">
			count: {{ count }}
		</view>
		
		<button size="default" type="default" @click="handleClick">按钮</button>
		
		<view v-for="item in list" :key="item.id" @click="toDetail(item.id, item.nm)">
			{{item.nm}}
		</view>
	</view>
	
</template>


<script setup>
	import { ref, onMounted } from "vue";
	import { onLoad } from "@dcloudio/uni-app";
	
	const count = ref(1);
	const handleClick = () => {
		count.value++;
	}
	
	const list = ref([]);
	onLoad(() => {
		uni.request({
			url: "http://118.24.239.63:3000/api/rated/list",
			data: {},
			success: function(res) {
				console.log(res.data);
				list.value = res.data.data;
			}
		});
	})
	
	const toDetail = (id, nm) => {
		uni.navigateTo({
			url: "/pages/detail/detail?id=" + id + "&nm=" + nm
		})
	}
</script>


<style lang="scss" scoped>
</style>
